import requests
import config.path_cnf as path_cnf


class HomeApi(object):
    def __init__(self):
        self.banner_url = path_cnf.EGO_URL + path_cnf.BANNER_URL
        self.theme_url = path_cnf.EGO_URL + path_cnf.THEME_URL
        self.recent_url = path_cnf.EGO_URL + path_cnf.PROD_RECENT_URL

    # 轮播图
    def get_banner(self, index):
        return requests.get(self.banner_url + str(index))

    # 专题栏位
    def get_theme(self, index):
        return requests.get(self.theme_url, params={'ids': index})

    # 最近新品
    def get_recent_product(self):
        return requests.get(self.recent_url)
